package Others.DesignPattern.PrototypePattern.Pattern;

import Others.DesignPattern.PrototypePattern.Pattern.Object.Resume;
import Others.DesignPattern.PrototypePattern.Pattern.Object1.ShallowCloneResume;
import Others.DesignPattern.PrototypePattern.Pattern.Object1.ShallowWorkExperience;
import Others.DesignPattern.PrototypePattern.Pattern.Object2.DeepCloneResume;
import Others.DesignPattern.PrototypePattern.Pattern.Object2.DeepWorkExperience;

public class main1 {
    public static void main(String[] args) throws CloneNotSupportedException {

        //当然这里只是一个简单的浅克隆，如果Resume中存在引用对象，那么按照当前这样写是没有用的


        ShallowCloneResume shallowCloneResume = new ShallowCloneResume("大鸟", "男", "29", "阿里", new ShallowWorkExperience("1998-2000"));
        shallowCloneResume.show();
        ShallowCloneResume cloneshallowCloneResumeA = (ShallowCloneResume)shallowCloneResume.clone();
        cloneshallowCloneResumeA.setShallowWorkExperience("2000-2001");
        cloneshallowCloneResumeA.show();

        System.out.println();
        shallowCloneResume.show();
        //会发现修改克隆对象也会导致源对象的值也会被修改--这显然不是一个真正的克隆对象



    }
}
